package material.command.undo;

public class RemoteLoader_CeilingFan {
    public static void main(String[] args) {
        /*创建风扇对象*/
        CeilingFan ceilingFan = new CeilingFan("卧室");
        /**创建风扇的具体命令**/
        CeilingFanHighCommand ceilingFanHigh = new CeilingFanHighCommand(ceilingFan);
        CeilingFanMediumCommand ceilingFanMedium = new CeilingFanMediumCommand(ceilingFan);
        CeilingFanOffCommand ceilingFanOff = new CeilingFanOffCommand(ceilingFan);
        /*创建遥控器*/
        RemoteControlWithUndo remoteControl = new RemoteControlWithUndo();
        /**将指令放入遥控器的插槽**/
        remoteControl.setCommand(0, ceilingFanMedium, ceilingFanOff);
        remoteControl.setCommand(1, ceilingFanHigh, ceilingFanOff);

        /**依次点击遥控器按钮**/
        System.out.println("---------------中速开，关闭，回退---------------");
        remoteControl.onButtonWasPushed(0);
        remoteControl.offButtonWasPushed(0);
        remoteControl.undoButtonWasPushed();
        System.out.println("---------------高速开，回退---------------");
        remoteControl.onButtonWasPushed(1);
        remoteControl.undoButtonWasPushed();

    }
}
